package cn.dyw.cloudmusic.config;

import org.apache.commons.lang3.concurrent.BasicThreadFactory;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author: dyw770
 * @Date: 2019/1/11 21:59
 * @Description: T线程池配置
 */
public class ThreadPoolConfig {

    private static final ThreadPoolExecutor executor = new ThreadPoolExecutor(
            8, 10,
            60, TimeUnit.SECONDS,
            new LinkedBlockingQueue<>(20),
            new BasicThreadFactory.Builder().namingPattern("crawl-thread-%d").build(),
            new ThreadPoolExecutor.AbortPolicy());

    public static ThreadPoolExecutor getThreadPool() {
        return executor;
    }
}
